<?php
define('PHPFOX', true);
define('PHPFOX_DS', DIRECTORY_SEPARATOR);
define('PHPFOX_DIR', dirname(__FILE__) . PHPFOX_DS);

class Topcmmchat_Component_Controller_Index extends Phpfox_Component
{
	public function process()
	{
        $oServiceFlashchat = Phpfox::getService('topcmmchat');
        $aSettings = $oServiceFlashchat->getSettings();
        $swfurl = $oServiceFlashchat->getClientUrl();
		$status = $oServiceFlashchat->getStatus();
		$rooms = $oServiceFlashchat->getRooms();
		$users = $oServiceFlashchat->getUsers();
		if ($users != null)
		{
			$users = array_chunk($users, 4, true);
		}
		$title = '123 Flash Chat';
		if (Phpfox::isUser())
		{
			$title .= ', ' . Phpfox::getUserBy('full_name') . '! ';
		}
		else
		{
			$title .= '! ';
		}
		$this->template()->setTitle($title)
					->setBreadcrumb($title)
      		->assign(array(
        		'status' => $status,
        		'rooms'  => $rooms,
        		'users'  => $users,
        		'swfurl' => $swfurl,
        		'aSettings' => $aSettings
			)
        );
        $this->template()->assign(array('bUseFullSite' => true));
	}
}

?>